﻿var plug = (function () {
    //private
    PlugInit = function () { if (typeof (jQuery) == 'undefined') { alert('请加载jQuery库'); return false; } return true; }
    getElementHeight = function (obj) {
        return jQuery(obj).height();
    };
    getElementWidth = function (obj) {
        return jQuery(obj).width();
    };
    getWindowCurrentHeight = function () {
        return jQuery(window).height();
    };
    getWindowCurrentWidth = function () {
        return jQuery(window).width();
    };
    getWindowMaxWidth = function () {
        return Math.max(jQuery(document.body).width(), jQuery(document).scroll().width());
    };
    getWindowMaxHeight = function () {
        return Math.max(jQuery(document.body).height(), jQuery(document).scroll().height());
    };
    getScrollTop = function () {
        return jQuery(document).scrollTop();
    };
    getScrollLeft = function () {
        return jQuery(document).scrollLeft()
    };
    return {
        //summary：
        //e.g: <input type="text" av="{x:'$email',t:'tipid',m:'email格式'}" id="txt"></input>
        AValidator: (function () {
            var reglib = {
                email: '^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$',
                date: '^(?:(?:1[6-9]|[2-9][0-9])[0-9]{2}([-/.]?)(?:(?:0?[1-9]|1[0-2])\\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\\1(?:29|30)|(?:0?[13578]|1[02])\\1(?:31))|(?:(?:1[6-9]|[2-9][0-9])(?:0[48]|[2468][048]|[13579][26])|(?:16|[2468][048]|[3579][26])00)([-/.]?)0?2\\2(?:29))$',
                async: false,
                ajax: {
                    username: function (username, onsuccess) {
                        $.ajax({
                            url: '/account/usernameonly',
                            type: 'get',
                            async:false,
                            data: { username: username },
                            success: function (result) {
                                onsuccess(result);
                            }
                        });
                    }
                }
            };
            setup = function (formid) {
                if ($('#' + formid).length > 0) {
                    $('[av]').each(function () {
                        $(this).blur(function () {
                            doValidate($(this));
                        });
                    });
                    $('#' + formid).submit(function () {
                        var isPass = true;
                        $('[av]').each(function () {
                            if (!doValidate($(this))) {
                                if (isPass) {
                                    isPass = false;
                                }
                            }
                        });
                        return isPass;
                    });
                }
            };
            getattribute = function (element) {
                if (element) {
                    var param = {};
                    var str = element.attr('av');
                    try {
                        var prop = eval('(' + str + ')');
                        if (prop) {
                            var regex = prop.x;
                            if (regex) {
                                if (regex.substring(0, 1) == ':') {
                                    //正则表达式方式
                                    param.regex = regex.substring(1);
                                }
                                else if (regex.substring(0, 1) == '$') {
                                    //预定义正则表达式方式
                                    var name = regex.substring(1);
                                    param.regex = eval('reglib.' + name);
                                }
                                else if (regex.substring(0, 1) == '=') {
                                    //值对比方式
                                    var targetid = regex.substring(1);
                                    param.regex = '^' + $('#' + targetid).val() + '$';
                                }
                            }
                            if (prop.ajax) {
                                param.ajax = prop.ajax;
                            }
                            param.msg = prop.m;
                            param.tip = prop.t;
                        }
                    }
                    catch (exp) {
                        return undefined;
                    }
                    return param;
                }
            };
            doValidate = function (element) {
                var param = getattribute(element);
                if (param) {
                    if (!eval('/' + param.regex + '/ig.test("' + element.val() + '")')) {
                        var tip = param.tip;
                        if (tip && $('#' + tip).length > 0) {
                            $('#' + tip).text(param.msg);
                        }
                        return false;
                    }
                    if (param.ajax) {
                        var func = eval('reglib.ajax.' + param.ajax.replace('$', ''));
                        if (func) {
                            var ispass = true;
                            func(element.val(), function (result) {
                                if (result == '1') {
                                    var tip = param.tip;
                                    if (tip && $('#' + tip).length > 0) {
                                        $('#' + tip).text('用户名重复');
                                    }
                                    ispass = false;
                                }
                            });
                            return ispass;
                        }
                    }
                    return true;
                }
                return false;
            };
            return function () {
                this.BuildValidate = function (formid) {
                    setup(formid);
                }
            }
        })(),
        //public
        //summary：给input元素添加默认提示文字
        ValueSkin: (function () {
            return function () {
                this.Register = function () {
                    $('input[default]').each(function () {
                        if ($(this).attr('type') == 'text') {
                            if ($(this).val().trim() == '') {
                                $(this).css({ 'color': '#999', 'font-style': 'italic' })
                                    .val($(this).attr('default'))
                                    .blur(function () {
                                        if ($(this).val().trim() == '') {
                                            $(this)
                                                .css({ 'color': '#999', 'font-style': 'italic' })
                                                .val($(this).attr('default'));
                                        }
                                    })
                                    .focus(function () {
                                        if ($(this).val().trim() == $(this).attr('default')) {
                                            $(this).val('').css({ 'color': '#000', 'font-style': 'normal' });
                                        }
                                    });
                            }
                        }
                    });
                }
            }
        })(),
        /*End ValueSkin Method**************************************/

        //summary：模态弹出层类
        PopFrame: (function () {
            //private
            return function () {
                //public
                /**************************************
                * summary：展现弹出层
                * param[poplayerid]:需要弹出的层id
                * param[closebtnid]:关闭该弹出层的按钮*/
                var hidselectList = [];
                var _width = -1; //获取弹出层真实宽度
                var _height = -1;  //获取弹出层真实高度
                this.OpenFrame = function (poplayerid, closebtnid, callback) {
                    if (jQuery.browser.version == '6.0') {
                        jQuery('select').each(function () {
                            if (jQuery(this).css('display') != 'none') {
                                hidselectList.push(jQuery(this));
                                jQuery(this).hide();
                            }
                        });
                    }

                    if (!PlugInit()) return;
                    var poplayer = jQuery('#' + poplayerid); //获取弹出层
                    if (poplayer == undefined) {
                        alert('无法获取到弹出层，这可能是dom元素未加载完成。');
                        return;
                    }
                    var background = "ipopbackground"; //新建遮罩层id
                    //if (_width == -1 || _height == -1) {
                    _width = getElementWidth(poplayer);  //获取弹出层真实宽度
                    _height = getElementHeight(poplayer); //获取弹出层真实高度
                    //}
                    if (poplayer.length > 0) jQuery(poplayer).remove(); //移除页面上元素
                    if (jQuery('#' + background).length > 0) jQuery('#' + background).remove(); //移除页面上元素 

                    //遮罩层
                    var newMask = jQuery('<div id=\'' + background + '\'/>');
                    newMask.css({
                        position: 'absolute',
                        zIndex: '10',
                        width: getWindowMaxWidth() + 'px',
                        height: getWindowMaxHeight() + 'px',
                        top: '0px',
                        left: '0px',
                        background: '#ccc',
                        filter: 'alpha(opacity=40)',
                        opacity: '0.30'
                    });
                    jQuery('body').append(newMask);
                    //新弹出层
                    var newDiv = jQuery('<div id=\'' + poplayerid + '\'/>');
                    newDiv.css({
                        display: 'block',
                        position: 'absolute',
                        zIndex: '99',
                        width: _width + 'px',
                        height: _height + 'px',
                        top: parseInt(getScrollTop() + getWindowCurrentHeight() / 2 - _height / 2, 10) + "px",
                        left: parseInt(getScrollLeft() + getWindowCurrentWidth() / 2 - _width / 2, 10) + "px",
                        background: "#fff",
                        border: '8px solid #bbb',
                        padding: '5px'
                    });
                    jQuery('body').append(newDiv.html(poplayer.html()).hide());
                    newDiv.fadeIn(600, function () {
                        if (typeof (callback) == 'function') {
                            callback();
                        }
                    });

                    //绑定关闭事件
                    jQuery('#' + closebtnid).click(function () {
                        var box = jQuery(newDiv).fadeOut(600, function () {
                            jQuery(newMask).remove();
                            jQuery(newDiv).remove();
                            var length = hidselectList.length;
                            for (var i = 0; i < length; i++) {
                                hidselectList[i].show();
                            }
                            jQuery('body').append(newDiv);
                        }); //.hide();
                    });

                    //绑定滚动事件
                    jQuery(window).scroll(function () {
                        newDiv.css({
                            top: (getScrollTop() + getWindowCurrentHeight() / 2 - _height / 2) + "px",
                            left: (getScrollLeft() + getWindowCurrentWidth() / 2 - _width / 2) + "px"
                        });
                    });
                    //窗体大小变化事件
                    jQuery(window).resize(function (a) {
                        newMask.css({
                            width: getWindowMaxWidth() + 'px',
                            height: getWindowMaxHeight() + 'px'
                        });
                        newDiv.css({
                            top: (getScrollTop() + getWindowCurrentHeight() / 2 - _height / 2) + "px",
                            left: (getScrollLeft() + getWindowCurrentWidth() / 2 - _width / 2) + "px"
                        });
                    });
                }
            }
        })(),
        /*End PopFrame Method**************************************/

        //summary：高亮控件
        HighLightControl: (function () {
            var cacheValueborder;
            var cacheValuebg;
            return function () {
                /**************************************
                * summary：启动注册高亮控件根据配置class决定高亮类型，高亮颜色为控件实际颜色
                * 当class为hightlightborder时 边框高亮 如果未配置颜色则为当前边框颜色 e.g: <input type="text" class="highlightborder #f00 highlightbg #ccc"/>
                * 当class为highlightbg时 为背景高亮 背景颜色必须配置 e.g: <input type="text" class="highlightbg b#ccc" /> 此时的高亮背景颜色为#ccc*/
                this.ResistHighLight = function () {
                    jQuery('.highlightborder').each(function () {
                        jQuery(this).css({ 'border': '1px solid #ccc' });
                        jQuery(this).focus(function () {
                            var focusbordercolor = /highlightborder\s#[A-Fa-f0-9\-]+/.exec(jQuery(this).attr('class'));
                            if (focusbordercolor != null && focusbordercolor.length > 0) {
                                focusbordercolor = focusbordercolor[0].replace('highlightborder ', '');
                                if (focusbordercolor.length < 4) {
                                    jQuery(this).css('borderWidth', '1px');
                                }
                                else {
                                    cacheValueborder = jQuery(this).css('borderColor');
                                    jQuery(this).css({
                                        'borderWidth': '1px',
                                        'borderColor': focusbordercolor
                                    });
                                }
                            }
                            else {
                                jQuery(this).css('borderWidth', '2px');
                            }
                        }).blur(function () {
                            if (jQuery(this).css('borderColor') != cacheValueborder) {
                                jQuery(this).css({
                                    'borderWidth': '1px',
                                    'borderColor': cacheValueborder
                                });
                            }
                            else {
                                jQuery(this).css('borderWidth', '1px');
                            }
                        });
                    });
                    jQuery('.highlightbg').each(function () {
                        jQuery(this).focus(function () {
                            var focusbgcolor = /highlightbg\s#[A-Fa-f0-9\-]+/.exec(jQuery(this).attr('class'));
                            if (focusbgcolor != null && focusbgcolor.length > 0) {
                                focusbgcolor = focusbgcolor[0].replace('highlightbg ', '');
                                if (focusbgcolor.length < 4) {
                                    return;
                                }
                                cacheValuebg = jQuery(this).css('backgroundColor');
                                jQuery(this).css('backgroundColor', focusbgcolor);
                            }
                            else {
                                cacheValuebg = jQuery(this).css('backgroundColor');
                            }
                        }).blur(function () {
                            jQuery(this).css('backgroundColor', cacheValuebg);
                        });

                    });
                }
            }
        })(),
        /*End HighLightControl Method**************************************/

        //summary：html编码
        Security: (function () {
            return function () {
                this.HTMLTextEncode = function (input) {
                    return input.replace(/</gi, '&lt;').replace(/>/gi, '&gt;');
                }
            }
        })(),
        /*End Security Method**************************************/
        //summary：控件数据绑定
        Control: (function () {
            return function () {
                this.BuildSelect = function (setting, datasource) {
                    var is = {
                        nobind: [], //不绑定到控件的值列表，比如 值为0,1,2 的项不绑定出来。则值为[0,1,2]
                        bindtype: 'value', //给option的value属性绑定数据源的value还是name
                        create: false, //创建一个新的select元素
                        defaultvalue: null, //如果选择的值
                        onchange: null //发生选择时的事件
                        //element:'' 需要提供元素的id
                        //elementName:'' [如果是新创建元素]元素的name
                    };
                    //如果参数是字符串，则认为是对一个已存在的select进行元素绑定
                    if ((typeof (setting)).toString().toLowerCase() == 'string') {
                        is.element = setting;
                        setting = is;
                    }
                    else {
                        setting = $.extend(is, setting);
                    }
                    var o = null;
                    if (setting.create) {
                        o = $('<select/>').attr('id', setting.element).attr('name', setting.elementName);
                        if (setting.onchange != null) {
                            o.change(setting.onchange);
                        }
                    }
                    else {
                        //如果不是创建新的，则根据id选择
                        o = $('#' + setting.element);
                    }

                    if (o.length > 0) {
                        datasource = data.GetDataSource(datasource);
                        for (var i = 0, len = datasource.length; i < len; i++) {
                            if (setting.nobind.contain(datasource[i].value)) {
                                continue;
                            }
                            var item = $('<option/>')
                                .text(datasource[i].name);
                            if (setting.bindtype == 'name') {
                                item.val(datasource[i].name);
                            }
                            else {
                                item.val(datasource[i].value);
                            }
                            if (setting.defaultvalue != null && setting.defaultvalue != '' && datasource[i].value == setting.defaultvalue) {
                                item.attr('selected', 'selected');
                            }
                            o.append(item);

                        }
                    }
                    return o;
                }
            };
        })(),
        BMap: (function () {
            var lng, lat;
            var location;
            var map, marker, myGeo;
            return function () {
                this.Design = function (container, address, location) {
                    this.location = location;
                    map = new BMap.Map(container);
                    map.enableScrollWheelZoom();
                    myGeo = new BMap.Geocoder();
                    myGeo.getPoint(location, function (point) {
                        if (point) {
                            lng = point.lng;
                            lat = point.lat;
                            map.centerAndZoom(point, 12);
                            map.addEventListener('rightclick', function (e) {
                                map.clearOverlays();
                                marker = new BMap.Marker(e.point);
                                marker.enableDragging();
                                lng = e.point.lng;
                                lat = e.point.lat;
                                map.addOverlay(marker);
                            });
                        }
                    }, location);
                },
				this.OpenMap = function (container, prop) {
				    map = new BMap.Map(container);
				    map.enableScrollWheelZoom();
				    if (prop.search) {
				        myGeo = new BMap.Geocoder();
				        myGeo.getPoint(prop.address, function (point) {
				            if (point) {
				                lng = point.lng;
				                lat = point.lat;
				                map.centerAndZoom(point, 13);
				                marker = new BMap.Marker(e.point);
				                marker.enableDragging();
				                lng = e.point.lng;
				                lat = e.point.lat;
				                map.addOverlay(marker);
				            }
				            else {
				                if (prop.error) {
				                    prop.error();
				                }
				            }
				        }, prop.location);
				    }
				    else {
				        var point = new BMap.Point(prop.lng, prop.lat);
				        map.centerAndZoom(point, prop.zoom);

				        marker = new BMap.Marker(point);
				        map.addOverlay(marker);
				    }
				},
				this.ClearMarker = function () {
				    map.clearOverlays();
				},
				this.CutMap = function (mustmark) {
				    if (mustmark) {
				        if (!marker) {
				            alert('请先通过鼠标右键标记您的位置！');
				            return;
				        }
				    }
				    return { zoom: map.getZoom(), lng: lng, lat: lat };
				}
            }
        })(),
        RollBlack: (function () {
            var cfg = {
                orientation: 'down',
                container: '',
                interval: 5000, //每次滚动平均间隔时间为 interval 到 interval*(1/probability)
                probability: 1, //应该设置为大于0且小于等于1
                warpwidth: '400px', //外框的宽度
                warpheight: '100px', //外框的高度
                itemCount: 5, //一共包含多少个子项 每个子项的高度为 warpheight/itemCount
                builddata: function () {
                    var source = data.GetDataSource('collage');
                    var collect = source[parseInt(Math.random() * 1000, 10) % source.length];
                    return '一位来至' + collect.name + '的朋友加入了我们';
                },
                buildline: function () {
                    var lineheight = parseInt(parseInt(cfg.warpheight, 10) / cfg.itemCount, 10);
                    return $('<div style="height:' + lineheight + 'px;line-height:' + lineheight + 'px;">' + cfg.builddata() + '</div>');
                }
            }
            function Init(lineheight) {
                var box = $('#' + cfg.container);
                cfg.probability = cfg.probability <= 0 ? 0.1 : cfg.probability >= 1 ? 1 : cfg.probability;
                if (box) {
                    box.html(''); //清空html
                    box.css({ 'height': cfg.warpheight, 'width': cfg.warpwidth, 'overflow': 'hidden' });
                    box.append($('<div style="height:' + (parseInt(cfg.warpheight, 10) + parseInt(lineheight, 10)) + 'px' + ';width:' + cfg.warpwidth + ';"></div>'));
                    if (cfg.orientation != 'up') {
                        box.children('div').css({ 'margin-top': '-20px' });
                    }
                    for (var i = 0; i < cfg.itemCount + 1; i++) {
                        box.children('div').append(cfg.buildline());
                    }
                }
            }
            return function () {
                this.BindControl = function (setting) {
                    if (!/object/i.test(typeof (setting))) {
                        return;
                    }
                    cfg = $.extend(cfg, setting);
                    var lineheight = parseInt(parseInt(cfg.warpheight, 10) / cfg.itemCount, 10);
                    var changemargin = lineheight + 'px';
                    Init(lineheight);
                    window.setInterval(function () {
                        var time = Math.random();
                        if (time < cfg.probability) {
                            if (cfg.orientation == 'up') {
                                $('#' + cfg.container).children('div').animate({ 'margin-top': '-' + changemargin }, 2000, 'swing', function () {
                                    $(this).children('div:eq(0)').remove();
                                    $(this).css({ 'margin-top': '0px' });
                                    $(this).append(cfg.buildline());
                                });
                            }
                            else {
                                $('#' + cfg.container).children('div').animate({ 'margin-top': '0px' }, 2000, 'swing', function () {
                                    $(this).children('div').last().remove();
                                    $(this).animate({ 'margin-top': '-20px' }, 0);
                                    cfg.buildline().insertBefore($(this).children('div:eq(0)'));
                                });
                            }
                        }
                    }, cfg.interval);
                }
            }
        })(),
        MessageBox: (function () {
            return function () {
                this.Show = function (html) {
                    if ($('#boxplugmsgboxcontainer').length == 0) {
                        var msgbox = $('<div id="boxplugmsgboxcontainer" style="display:none;width:300px;height:auto;padding:50px 10px 30px 10px;"><div style="width:280px;height:auto;">' + html + '</div><div style="width:85px;margin-left:auto;margin-right:auto;"><a href="javascript:;" id="btnplugmsgboxclose"><img src="/content/images/submit.png" alt="ok"/></a></div></div></div>');
                        $('body').append(msgbox);
                    }
                    var popbox = new plug.PopFrame();
                    popbox.OpenFrame('boxplugmsgboxcontainer', 'btnplugmsgboxclose', null);
                }
            }
        })(),
        SwfUpload: (function () {
            var def = {
                file_size_limit: "7 MB",
                file_types: "*.*",
                file_types_description: "All Files",
                file_upload_limit: 0,
                flash_url: "/scripts/swfupload/swfupload.swf",
                button_image_url: '/scripts/swfupload/btn_upload.png',
                button_width: 125,
                button_height: 40,
                button_placeholder: 'btnswfupload',

                file_queued_handler: function (event, file) {
                    onAppend(event, file);
                    //一个文件选择完毕。触发startUpload事件，开始上传本文件
                    $(this).swfupload('startUpload');
                },
                file_queue_error_handler: function (event, file, errorCode, message) {
                    onError();
                },
                upload_start_handler: function (event, file) {
                    onBegin(event, file);
                },
                upload_progress_handler: function (event, file, bytesLoaded) {
                    Progress(event, file, bytesLoaded);
                },
                upload_success_handler: function (event, file, serverData) {
                    onSuccess(event, file, serverData);
                },
                upload_complete_handler: function (event, file) {
                    onComplete(event, file);
                    //本文件已经上传完毕。开始上传队列中下个文件
                    $(this).swfupload('startUpload');
                },
                upload_error_handler: function (event, file, errorCode, message) {
                    onError(event, file, errorCode, message);
                },

                /***********************************************/
                onAppend: function (event, file) { },
                onBegin: function (event, file) { },
                Progress: function (event, file, bytesLoaded) { },
                onComplete: function (event, file) { },
                onSuccess: function (event, file, serverData) { },
                onError: function (event, file, errorCode, message) { }
            };
            var isLoad = false;
            return function () {
                this.Bind = function (container, setting) {
                    if (!isLoad && $('#' + container)) {
                        setting = $.extend(def, setting);
                        $('#' + container).append($('<div><input type="button" id="btnswfupload" /></div>'));
                        $('#' + container).swfupload(setting);
                        isLoad = true;
                    }
                }
            }
        })()
    }
})();

var data = {
    GetDataSource: function (key) {
        switch (key.toLowerCase()) {
            case 'workarea':
                return data.WorkArea;
                break;
            case 'positiontype':
                return data.PositionType;
                break;
            case 'degree':
                return data.DegreeRequire;
                break;
            case 'period':
                return data.Period;
                break;
            case 'business':
                return data.Business;
                break;
            case 'companytype':
                return data.CompanyType;
                break;
            case 'companydimensions':
                return data.CompanyDimensions;
                break;
            case 'collage':
                return data.Collage;
                break;
        }
    },
    //注意，value必须连续
    WorkArea: [
    { name: '所有区域', value: '0' }, { name: '渝中区', value: '1' }, { name: '沙坪坝区', value: '2' },
    { name: '大学城', value: '3' }, { name: '江北区', value: '4' }, { name: '渝北区', value: '5' },
    { name: '九龙坡区', value: '6' }, { name: '北碚区', value: '7' }, { name: '大渡口区', value: '8' },
    { name: '南岸区', value: '9' }, { name: '巴南区', value: '10' }, { name: '两江新区', value: '11' },
    { name: '重庆周边', value: '12'}],
    //注意，value必须连续
    PositionType: [
    { name: '所有职位', value: '0' }, { name: '促销员', value: '1' }, { name: '模特', value: '2' },
    { name: '礼仪', value: '3' }, { name: '教师/家教/培训', value: '4' }, { name: '手工制作', value: '5' },
    { name: '服务员', value: '6' }, { name: '学生兼职', value: '7' }, { name: '客服/传单派发', value: '8' },
    { name: '网站建设推广', value: '9' }, { name: '会计', value: '10' }, { name: '实习生', value: '11' },
    { name: '小时工/钟点工', value: '12' }, { name: '翻译', value: '13' }, { name: '问卷调查员', value: '14' },
    { name: '演员', value: '15' }, { name: '销售', value: '16' }, { name: '编辑/排版', value: '17' },
    { name: '摄影/影像/设计', value: '18' }, { name: '其他兼职', value: '19' }
    ],
    DegreeRequire: [
    { name: '不限', value: '0' }, { name: '专科', value: '1' }, { name: '本科', value: '2' },
    { name: '硕士', value: '3' }
    ],
    Period: [
    { name: '每小时', value: '160' }, { name: '每一天', value: '40' }, { name: '每一周', value: '8' },
    { name: '一个月', value: '1' }
    ],
    Business: [
    { name: '酒店/餐饮', value: '1' }, { name: '生产/制造', value: '2' }, { name: '广告/会展', value: '3' },
    { name: '机械/仪器仪表', value: '4' }, { name: '超市/百货/零售', value: '5' }, { name: '贸易/交通/运输/物流', value: '6' },
    { name: '美术/设计/创意', value: '7' }, { name: '电气/能源/动力', value: '8' }, { name: '计算机/网络/通信', value: '9' },
    { name: '汽车销售与服务', value: '10' }, { name: '编辑/出版/印刷', value: '11' }, { name: '石油/石化/化工', value: '12' },
    { name: '人力资源', value: '13' }, { name: '保险', value: '14' }, { name: '美容美发', value: '15' },
    { name: '农/林/牧/渔', value: '16' }, { name: '行政/后勤', value: '17' }, { name: '中介服务', value: '18' },
    { name: '保健按摩', value: '19' }, { name: '环保', value: '20' }, { name: '财务/审计/税务', value: '21' },
    { name: '教育/培训', value: '22' }, { name: '运动健身', value: '23' }, { name: '媒体/影视/文化', value: '24' },
    { name: '金融/银行/投资/基金/证券', value: '25' }, { name: '建筑/装修', value: '26' }, { name: '旅游', value: '27' },
    { name: '法律', value: '28' }, { name: '市场/公关/媒介', value: '29' }, { name: '物业管理/商业中心', value: '30' },
    { name: '医院/医疗/护理', value: '31' }, { name: '学术/科研', value: '32' }, { name: '咨询/顾问', value: '33' },
    { name: '家政', value: '34' }, { name: '医药/生物工程', value: '35' }, { name: '礼品/玩具/工艺美术/收藏品', value: '36' },
    { name: '耐用消费品(服装服饰/纺织/皮革/家具/家电)', value: '37' }, { name: '跨领域经营', value: '38' }, { name: '其他行业', value: '39' }
    ],
    CompanyType: [
    { name: '股份制企业', value: '1' }, { name: '民营企业', value: '2' }, { name: '国有企业', value: '3' },
    { name: '外商独资', value: '4' }, { name: '其他', value: '5' }
    ],
    CompanyDimensions: [
    { name: '50人以下', value: '1' }, { name: '50-150人', value: '2' }, { name: '200-500人', value: '3' },
    { name: '500人以上', value: '4' }
    ],
    Collage: [{ name: '重庆大学', value: '1' }, { name: '西南大学', value: '2' }
    , { name: '重庆师大', value: '3' }, { name: '西南政法', value: '4' }, { name: '重庆交大', value: '5' }
    , { name: '重庆邮电大学', value: '6' }, { name: '重庆医大', value: '7' }, { name: '重庆工商', value: '8' }
    , { name: '重庆科技学院', value: '9' }, { name: '重庆理工大学', value: '10' }, { name: '重庆文理', value: '11' }
    , { name: '后勤工程学院', value: '12' }, { name: '四川外语学院', value: '13' }, { name: '重庆南方翻译学院', value: '14' }
    , { name: '长江师范学院', value: '15' }, { name: '四川外国语', value: '16' }, { name: '四川美院', value: '17' }
    , { name: '重庆三峡学院', value: '18' }, { name: '重庆化工职业学院', value: '19' }, { name: '重庆能源职业学院', value: '20' }
    , { name: '重庆商务职业学院', value: '21' }, { name: '重庆旅游职业学院', value: '22' }, { name: '重庆五一高级技师学院', value: '23' }
    , { name: '重庆通信学院', value: '24' }, { name: '重庆轻工职业学院', value: '25' }, { name: '重庆经贸职业学院', value: '26' }
    , { name: '重庆公共运输职业学院', value: '27' }, { name: '三峡师范学校', value: '28' }, { name: '重庆艺术工程职业学院', value: '29' }
    , { name: '重庆房地产职业学院', value: '30' }, { name: '重庆城市职业学院', value: '31' }, { name: '重庆电力高等专科学校', value: '32' }
    , { name: '重庆电子工程职业学院', value: '33' }, { name: '重庆航天职业技术学院', value: '34' }, { name: '重庆工程职业技术学院', value: '35' }
    , { name: '重庆工商职业学院', value: '36' }, { name: '重庆工业职业技术学院', value: '37' }, { name: '重庆传媒职业学院', value: '38' }
    , { name: '重庆海联职业技术学院', value: '39' }, { name: '重庆机电职业技术学院', value: '40' }, { name: '重庆警官职业学院', value: '41' }
    , { name: '重庆民生职业技术学院', value: '42' }, { name: '重庆三峡医药高等专科学校', value: '43' }, { name: '重庆三峡职业学院', value: '44' }
    , { name: '重庆水利电力职业技术学院', value: '45' }, { name: '重庆信息技术职业学院', value: '46' }, { name: '重庆医药高等专科学校', value: '47' }
    , { name: '重庆正大软件职业技术学院', value: '48' }, { name: '重庆职业技术学院', value: '49' }, { name: '重庆教育学院', value: '50' }
    , { name: '重庆应用外国语专修学院', value: '51' }, { name: '重庆大学城市科技学院', value: '52' }, { name: '西南大学育才学院', value: '53' }
    , { name: '重庆师范大学涉外商贸学院', value: '54' }, { name: '重庆工商大学融智学院', value: '55' }, { name: '重庆工商大学派斯学院', value: '56' }
    , { name: '重庆邮电大学移通学院', value: '57' }, { name: '重庆工贸职业技术学院', value: '58' }, { name: '重庆青年职业技术学院', value: '59' }
    , { name: '重庆城市管理职业学院', value: '60' }, { name: '重庆财经职业学院', value: '61' }, { name: '重庆科创职业学院', value: '62' }
    , { name: '重庆建筑工程职业学院', value: '63' }, { name: '重庆五一技师学院', value: '64' }, { name: '重庆通信学院', value: '65' }
    , { name: '西南大学应用技术学院', value: '66' }, { name: '重庆交通职业学院', value: '67' }, { name: '重庆电讯职业学院', value: '68'}]
}

Array.prototype.contain = function (val) {
    var arr = this;
    for (var i = 0, len = arr.length; i < len; i++) {
        if (arr[i] == val) {
            return true;
        }
    }
    return false;
}
String.prototype.trim = function () {
    return this.toString().replace(/^\s*|\s*$/g, '');
}